home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / var / lib / dpkg / info / passwd.postinst < prev    next >
Encoding:
Text File  |  2006-12-19  |  2.3 KB  |  72 lines

  1. #!/bin/sh -e
  2.  
  3. test -f /usr/share/debconf/confmodule && . /usr/share/debconf/confmodule
  4.  
  5. case "$1" in
  6. configure)
  7.     # Fix permissions on various log files from old versions of the debian
  8.     # installer, some unrelated to passwd but we decided to put the fix
  9.     # here since there was no better place. This can safely be removed
  10.     # after etch is released.
  11.     # In Ubuntu, it may be wise to keep this code around for longer, since
  12.     # this bug left passwords exposed in Ubuntu 5.10:
  13.     #   https://launchpad.net/bugs/34606
  14.     if dpkg --compare-versions "$2" lt "1:4.0.14-9"; then
  15.         if egrep -qs 'passwd/(root|user)-password' /var/log/installer/cdebconf/*
  16.         then
  17.             perl -000 -pi -e '
  18.                 if (m{^Name: passwd/(?:root|user)-password(?:-again)? *$}m) {
  19.                     s/^Value:.*\n//m
  20.                 }' /var/log/installer/cdebconf/* || true
  21.         fi
  22.         for log in /var/log/base-config* \
  23.             $(find /var/log/debian-installer/ /var/log/installer/ -type f 2>/dev/null ); do
  24.         if [ -e "$log" ]; then
  25.             chmod 600 "$log"
  26.         fi
  27.             done
  28.     fi
  29.  
  30.     rm -f /etc/pam.d/passwd.pre-upgrade 2>/dev/null
  31.     if ! getent group shadow | grep -q '^shadow:[^:]*:42'
  32.     then
  33.         groupadd -g 42 shadow || (
  34.                 cat <<EOF
  35. Group ID 42 has been allocated for the shadow group.  You have either
  36. used 42 yourself or created a shadow group with a different ID.
  37. Please correct this problem and reconfigure with ``dpkg --configure passwd''.
  38.  
  39. Note that both user and group IDs in the range 0-99 are globally
  40. allocated by the Debian project and must be the same on every Debian
  41. system.
  42. EOF
  43.                 exit 1
  44.         )
  45.     fi
  46.  
  47.     # Tidy up after installer security bug that left an empty root
  48.     # password if you backed up from the installer's final message:
  49.     #   https://launchpad.net/bugs/48350
  50.     if (dpkg --compare-versions "$2" lt-nl 1:4.0.13-7ubuntu3.2 || \
  51.         [ "$2" = 1:4.0.16-2ubuntu1 ]) && \
  52.        perl -e '(my @root = getpwnam "root") or exit 1;
  53.             my $rootpw = $root[1];
  54.             $rootpw =~ /^(\$1\$[^\$]*\$?)/ or exit 1;
  55.             my $salt = $1;
  56.             exit 1 if $salt eq "";
  57.             my $emptypw = crypt("", $salt);
  58.             exit (($rootpw eq $emptypw) ? 0 : 1);'
  59.     then
  60.         echo "Locking root password left blank by installer bug ..."
  61.         echo 'root:*' | chpasswd -e -m
  62.     fi
  63.     ;;
  64. esac
  65.  
  66. # Run shadowconfig only on new installs
  67. [ -z "$2" ] && shadowconfig on
  68.  
  69.  
  70.  
  71. exit 0
  72.